package com.jiangroom.ribbon.web;

import com.jiangroom.ribbon.domain.User;
import com.jiangroom.ribbon.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dengzaiqiang
 * @createTime 2018/4/12
 * @description ribbon
 */
@RestController
public class RibbonConsumerController {

    @Autowired
    private HelloService helloService;

    @RequestMapping("/hello-consumer")
    public String helloConsumer() {
        return helloService.hello();
    }

    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable("id") Long id){
        return helloService.getUserById(id);
    }
}
